<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 组件之间的数据不共享的 -->
      <!-- 
        父传子：
          1. 在父组件的子组件标签中添加自定义属性(传值)
          2. 在子组件里面添加props选项(接受)
      -->
      <h3>组件传参 - {{ count }}</h3>
      <app-child msg="hello" :count="count"></app-child>
    </div>

    <script src="../Vue.js"></script>
    <script>
      Vue.component("app-child", {
        // data() {
        //   return {
        //     count: 10,
        //   };
        // },
        props: ["msg", "count"],
        template: `
          <div>app-child - {{ msg }} - {{ count }}</div>
        `,
      });

      new Vue({
        el: "#app",
        data: {
          count: 20,
        },
      });
    </script>
  </body>
</html>
